package com.xoa.controller.party;

import com.xoa.model.party.VisitRecords;
import com.xoa.service.party.VisitRecordService;
import com.xoa.util.common.wrapper.BaseWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by 程叶同 on 2018/1/10.
 */
@Controller
@RequestMapping("visitrecords")
public class VisitRecordController {
    @Autowired
    VisitRecordService visitRecordService;

    /**
    * @Author 程叶同
    * @Description 添加
    * @Date 14:45 2018/1/10
    */
    @RequestMapping("/addRecords")
    @ResponseBody
    public BaseWrapper addRecords(VisitRecords visitRecords){
        return  visitRecordService.addRecords(visitRecords);
    }

    /**
    * @Author 程叶同
    * @Description 修改
    * @Date 14:49 2018/1/10
    */
    @RequestMapping("/updateRecords")
    @ResponseBody
    public BaseWrapper updateRecords(VisitRecords visitRecords){
        return  visitRecordService.updateRecords(visitRecords);
    }


    /**
    * @Author 程叶同
    * @Description 查询单条信息
    * @Date 14:49 2018/1/10
    */
    @RequestMapping("/getRecordsById")
    @ResponseBody
    public BaseWrapper getRecordsById(HttpServletRequest request, Integer id){
        return  visitRecordService.getRecordsById(request,id);
    }


    /**
    * @Author 程叶同
    * @Description 列表展示
    * @Date 14:49 2018/1/10
    */
    @RequestMapping("getList")
    @ResponseBody
    public BaseWrapper getList(HttpServletRequest request, Integer page, Integer pageSize, String startTime, String endTime, String unitName){
        return  visitRecordService.getList(request,page,pageSize,startTime,endTime,unitName);
    }


}
